package org.framework.lazy.cloud.network.heartbeat.server.config;


import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
import org.framework.lazy.cloud.network.heartbeat.server.netty.permeate.tcp.advanced.*;
import org.framework.lazy.cloud.network.heartbeat.server.netty.permeate.udp.advanced.*;
import org.framework.lazy.cloud.network.heartbeat.server.netty.proxy.http.advanced.*;
import org.framework.lazy.cloud.network.heartbeat.server.netty.proxy.socks.advanced.*;
import org.framework.lazy.cloud.network.heartbeat.server.properties.ServerNodeProperties;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.*;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Role;


@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class ServerAutoConfiguration {


    @Configuration( )
    static class ServerTcpConfiguration{
        /**
         * 服务端 处理客户端心跳
         *
         * @return ServerHandleTcpChannelHeartbeatTypeAdvanced
         */
        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        public ServerHandleTcpChannelHeartbeatTypeAdvanced serverChannelHeartbeatTypeAdvanced() {
            return new ServerHandleTcpChannelHeartbeatTypeAdvanced();
        }

        /**
         * 处理 服务端处理客户端数据传输
         *
         * @return ServerHandleTcpReportServicePermeateClientTransferTypeAdvanced
         */
        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleTcpReportServicePermeateClientTransferTypeAdvanced serverHandleTcpReportServicePermeateClientTransferTypeAdvanced(ChannelFlowAdapter channelFlowAdapter) {
            return new ServerHandleTcpReportServicePermeateClientTransferTypeAdvanced(channelFlowAdapter);
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleTcpClientConnectSuccessTypeAdvanced serverHandleTcpClientConnectSuccessTypeAdvanced(
                LazyClientStatsChangeApplication lazyClientStatsChangeApplication,
                LazyNettyClientBlacklistApplication lazyNettyClientBlacklistApplication,
                LazyServerPermeateClientMappingApplication lazyServerPermeateClientMappingApplication,
                LazyClientPermeateServerMappingApplication lazyClientPermeateServerMappingApplication,
                LazyClientPermeateClientMappingApplication lazyClientPermeateClientMappingApplication,
                LazyNettyServerVirtualRouteApplication lazyNettyServerVirtualRouteApplication,
                LazyNettyClientVirtualRouteApplication lazyNettyClientVirtualRouteApplication,
                LazyNettyClientTokenBucketApplication lazyNettyClientTokenBucketApplication,
                ServerNodeProperties serverNodeProperties
        ) {
            return new ServerHandleTcpClientConnectSuccessTypeAdvanced(
                    lazyClientStatsChangeApplication,
                    lazyNettyClientBlacklistApplication,
                    lazyServerPermeateClientMappingApplication,
                    lazyClientPermeateServerMappingApplication,
                    lazyClientPermeateClientMappingApplication,
                    lazyNettyServerVirtualRouteApplication,
                    lazyNettyClientVirtualRouteApplication,
                    lazyNettyClientTokenBucketApplication,
                    serverNodeProperties
            );
        }

        /**
         * 服务端处理集群注册信息
         *
         * @return ServerHandleTcpReportClusterNodeRegisterTypeAdvanced
         */
        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleTcpReportClusterNodeRegisterTypeAdvanced serverHandleTcpReportClusterNodeRegisterTypeAdvanced() {
            return new ServerHandleTcpReportClusterNodeRegisterTypeAdvanced();
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleTcpReportDisconnectTypeAdvanced serverHandleTcpReportDisconnectTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
            return new ServerHandleTcpReportDisconnectTypeAdvanced(lazyClientStatsChangeApplication);
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleTcpReportServicePermeateClientCloseVisitorTypeAdvanced serverHandleTcpReportServicePermeateClientCloseVisitorTypeAdvanced() {
            return new ServerHandleTcpReportServicePermeateClientCloseVisitorTypeAdvanced();
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleTcpReportServicePermeateClientRealConnectTypeAdvanced serverHandleTcpReportServicePermeateClientRealConnectTypeAdvanced() {
            return new ServerHandleTcpReportServicePermeateClientRealConnectTypeAdvanced();
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleTcpReportStagingClosedTypeAdvanced serverHandleTcpReportStagingClosedTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
            return new ServerHandleTcpReportStagingClosedTypeAdvanced(lazyClientStatsChangeApplication);
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleTcpReportStagingOpenedTypeAdvanced serverHandleTcpReportStagingOpenedTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
            return new ServerHandleTcpReportStagingOpenedTypeAdvanced(lazyClientStatsChangeApplication);
        }
    }

    @Configuration( )
    static class ServerUdpConfiguration{
        /**
         * 服务端 处理客户端心跳
         *
         * @return ServerHandleUdpChannelHeartbeatTypeAdvanced
         */
        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        public ServerHandleUdpChannelHeartbeatTypeAdvanced serverHandleUdpChannelHeartbeatTypeAdvanced() {
            return new ServerHandleUdpChannelHeartbeatTypeAdvanced();
        }

        /**
         * 处理 服务端处理客户端数据传输
         *
         * @return ServerHandleUdpReportServicePermeateClientTransferTypeAdvanced
         */
        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleUdpReportServicePermeateClientTransferTypeAdvanced serverHandleUdpReportServicePermeateClientTransferTypeAdvanced(ChannelFlowAdapter channelFlowAdapter) {
            return new ServerHandleUdpReportServicePermeateClientTransferTypeAdvanced(channelFlowAdapter);
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleUdpClientConnectSuccessTypeAdvanced serverHandleUdpClientConnectSuccessTypeAdvanced(
                LazyClientStatsChangeApplication lazyClientStatsChangeApplication,
                LazyNettyClientBlacklistApplication lazyNettyClientBlacklistApplication,
                LazyServerPermeateClientMappingApplication lazyServerPermeateClientMappingApplication,
                LazyClientPermeateServerMappingApplication lazyClientPermeateServerMappingApplication,
                LazyClientPermeateClientMappingApplication lazyClientPermeateClientMappingApplication,
                LazyNettyClientTokenBucketApplication lazyNettyClientTokenBucketApplication,
                ServerNodeProperties serverNodeProperties
        ) {
            return new ServerHandleUdpClientConnectSuccessTypeAdvanced(lazyClientStatsChangeApplication,
                    lazyNettyClientBlacklistApplication,
                    lazyServerPermeateClientMappingApplication,
                    lazyClientPermeateServerMappingApplication,
                    lazyClientPermeateClientMappingApplication,
                    lazyNettyClientTokenBucketApplication,
                    serverNodeProperties
            );
        }

        /**
         * 服务端处理集群注册信息
         *
         *
         * @return ServerHandleUdpReportClusterNodeRegisterTypeAdvanced
         */
        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleUdpReportClusterNodeRegisterTypeAdvanced serverHandleUdpReportClusterNodeRegisterTypeAdvanced() {
            return new ServerHandleUdpReportClusterNodeRegisterTypeAdvanced();
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleUdpReportDisconnectTypeAdvanced serverHandleUdpReportDisconnectTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
            return new ServerHandleUdpReportDisconnectTypeAdvanced(lazyClientStatsChangeApplication);
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleUdpReportServicePermeateClientCloseVisitorTypeAdvanced serverHandleUdpReportServicePermeateClientCloseVisitorTypeAdvanced() {
            return new ServerHandleUdpReportServicePermeateClientCloseVisitorTypeAdvanced();
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleUdpReportServicePermeateClientRealConnectTypeAdvanced serverHandleUdpReportServicePermeateClientRealConnectTypeAdvanced() {
            return new ServerHandleUdpReportServicePermeateClientRealConnectTypeAdvanced();
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleUdpReportStagingClosedTypeAdvanced serverHandleUdpReportStagingClosedTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
            return new ServerHandleUdpReportStagingClosedTypeAdvanced(lazyClientStatsChangeApplication);
        }

        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
        @Bean
        static ServerHandleUdpReportStagingOpenedTypeAdvanced serverHandleUdpReportStagingOpenedTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
            return new ServerHandleUdpReportStagingOpenedTypeAdvanced(lazyClientStatsChangeApplication);
        }
    }


    @Configuration()
    static class ServerHttpProxyConfiguration {
        @Bean
        public ServerHandleHttpReportClientProxyServerProxyTransferTypeAdvanced serverHandleHttpReportClientProxyServerProxyTransferTypeAdvanced() {
            return new ServerHandleHttpReportClientProxyServerProxyTransferTypeAdvanced();
        }

        @Bean
        public ServerHandleHttpReportClientProxyServerTransferCloseTypeAdvanced serverHandleHttpReportClientProxyServerTransferCloseTypeAdvanced() {
            return new ServerHandleHttpReportClientProxyServerTransferCloseTypeAdvanced();
        }

        @Bean
        public ServerHandleHttpReportClientProxyClientConnectTransferTypeAdvanced serverHandleHttpReportClientProxyClientConnectTransferTypeAdvanced() {
            return new ServerHandleHttpReportClientProxyClientConnectTransferTypeAdvanced();
        }

        @Bean
        public ServerHandleHttpReportClientProxyClientTransferChannelInitSuccessfulTypeAdvanced serverHandleHttpReportClientProxyClientTransferChannelInitSuccessfulTypeAdvanced() {
            return new ServerHandleHttpReportClientProxyClientTransferChannelInitSuccessfulTypeAdvanced();
        }

        @Bean
        public ServerHandleHttpReportClientProxyClientTransferResponseTypeAdvanced serverHandleHttpReportClientProxyClientTransferResponseTypeAdvanced() {
            return new ServerHandleHttpReportClientProxyClientTransferResponseTypeAdvanced();
        }
        @Bean
        public ServerHandleHttpReportServerProxyClientTransferTypeAdvanced serverHandleHttpReportClientProxyServerProxyTransferTypeAdvanced1() {
            return new ServerHandleHttpReportServerProxyClientTransferTypeAdvanced();
        }
        @Bean
        public ServerHandleHttpReportClientProxyClientTransferCloseTypeAdvanced serverHandleHttpReportClientProxyClientTransferCloseTypeAdvanced(){
            return new ServerHandleHttpReportClientProxyClientTransferCloseTypeAdvanced();
        }

        @Bean
        public ServerHandleHttpReportServerProxyClientTransferChannelInitSuccessfulTypeAdvanced serverHandleHttpReportServerProxyClientTransferChannelInitSuccessfulTypeAdvanced() {
            return new ServerHandleHttpReportServerProxyClientTransferChannelInitSuccessfulTypeAdvanced();
        }

        @Bean
        public ServerHandleHttpReportServerProxyClientTransferResponseTypeAdvanced serverHandleHttpReportServerProxyClientTransferResponseTypeAdvanced() {
            return new ServerHandleHttpReportServerProxyClientTransferResponseTypeAdvanced();
        }

        @Bean
        public ServerHandleHttpReportServerProxyClientTransferCloseTypeAdvanced serverHandleHttpReportServerProxyClientTransferCloseTypeAdvanced() {
            return new ServerHandleHttpReportServerProxyClientTransferCloseTypeAdvanced();
        }
    }
    @Configuration
    static class ServerSocksProxyConfiguration{

        @Bean
        public ServerHandleSocksReportClientProxyServerConnectTransferTypeAdvanced serverHandleSocksReportClientProxyServerConnectTransferTypeAdvanced(){
            return new ServerHandleSocksReportClientProxyServerConnectTransferTypeAdvanced();
        }
        @Bean
        public ServerHandleSocksReportClientProxyServerTransferCloseTypeAdvanced serverHandleSocksReportClientProxyServerTransferCloseTypeAdvanced(){
            return new ServerHandleSocksReportClientProxyServerTransferCloseTypeAdvanced();
        }
        @Bean
        public ServerHandleSocksReportClientProxyServerTransferRequestTypeAdvanced serverHandleSocksReportClientProxyServerTransferRequestTypeAdvanced(){
            return new ServerHandleSocksReportClientProxyServerTransferRequestTypeAdvanced();
        }

        @Bean
        public ServerHandleSocksReportClientProxyClientConnectTransferTypeAdvanced serverHandleSocksReportClientProxyClientConnectTransferTypeAdvanced() {
            return new ServerHandleSocksReportClientProxyClientConnectTransferTypeAdvanced();
        }

        @Bean
        public ServerHandleSocksReportClientProxyClientTransferCloseTypeAdvanced serverHandleSocksReportClientProxyClientTransferCloseTypeAdvanced() {
            return new ServerHandleSocksReportClientProxyClientTransferCloseTypeAdvanced();
        }

        @Bean
        public ServerHandleSocksReportClientProxyClientTransferRequestTypeAdvanced serverHandleSocksReportClientProxyClientTransferRequestTypeAdvanced() {
            return new ServerHandleSocksReportClientProxyClientTransferRequestTypeAdvanced();
        }

        @Bean
        public ServerHandleSocksReportClientProxyClientOtherConnectionTransferSuccessTypeAdvanced serverHandleSocksReportClientProxyClientOtherConnectionTransferSuccessTypeAdvanced() {
            return new ServerHandleSocksReportClientProxyClientOtherConnectionTransferSuccessTypeAdvanced();
        }
        @Bean
        public ServerHandleSocksReportClientProxyClientTransferResponseTypeAdvanced serverHandleSocksReportClientProxyClientTransferResponseTypeAdvanced(){
            return new ServerHandleSocksReportClientProxyClientTransferResponseTypeAdvanced();
        }

        @Bean
        public ServerHandleSocksReportServerProxyClientTypeAdvanced serverHandleSocksServerProxyClientTypeAdvanced() {
            return new ServerHandleSocksReportServerProxyClientTypeAdvanced();
        }


        @Bean
        public ServerHandleSocksReportServerProxyClientConnectionSuccessTypeAdvanced serverHandleSocksReportServerProxyClientConnectionSuccessTypeAdvanced(){
            return new ServerHandleSocksReportServerProxyClientConnectionSuccessTypeAdvanced();
        }
        @Bean
        public ServerHandleSocksReportServerProxyClientResponseTypeAdvanced serverHandleSocksReportServerProxyClientResponseTypeAdvanced(){
            return new ServerHandleSocksReportServerProxyClientResponseTypeAdvanced();
        }
        @Bean
        public ServerHandleSocksReportServerProxyClientTransferCloseTypeAdvanced serverHandleSocksReportServerProxyClientTransferCloseTypeAdvanced(){
            return new ServerHandleSocksReportServerProxyClientTransferCloseTypeAdvanced();
        }
    }
}
